-
Notifications
You must be signed in to change notification settings - Fork 24
Feat: Funding Pot #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Feat: Funding Pot #741
Conversation
} | ||
|
||
if (block.timestamp > round_.roundStart) { | ||
revert Module__LM_PC_FundingPot__RoundAlreadyStarted(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of a nitpick, but since this will also trigger if somebody tries to edit an already finished round, maybe we can change the name (or add an extra error if size allows for it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really come up with a more descriptive error since the idea is that the admin can edit as long as a round hasn't started. Imo the error exactly tells this story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fair. My comment came from the thought of "if a round started and ended, it's weird to revert saying 'it started' ". But it makes sense, the condition is "rounds are editable before start". Let's leavi it like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general looks good, there are a couple of things I pointed out. I also have still an open question about the caps/accesstypes, but I wanted to get this out first
f8d3200
to
8dda04f
Compare
} | ||
|
||
if (block.timestamp > round_.roundStart) { | ||
revert Module__LM_PC_FundingPot__RoundAlreadyStarted(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, fair. My comment came from the thought of "if a round started and ended, it's weird to revert saying 'it started' ". But it makes sense, the condition is "rounds are editable before start". Let's leavi it like that.
// Constants | ||
|
||
/// @notice The role that allows creating funding rounds. | ||
bytes32 public constant FUNDING_POT_ADMIN_ROLE = "FUNDING_POT_ADMIN"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to update it for the new authorization logic
} | ||
|
||
/// @inheritdoc ILM_PC_FundingPot_v1 | ||
function getRoundAccessCriteria(uint32 roundId_, uint8 accessCriteriaId_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should revert if the roundId_ or its accessCriteriaId_ don't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Unless returning all empty over revert is intended)
) external onlyModuleRole(FUNDING_POT_ADMIN_ROLE) { | ||
Round storage round = rounds[roundId_]; | ||
|
||
if (accessCriteriaType_ > MAX_ACCESS_CRITERIA_ID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it checks against the type not the id. According to the name and other uses of MAX_ACCESS_CRITERIA_ID, it should both check here against accessCriteriaId_ instead of accessCriteriaType_, and in if accessCriteriaId_ is 0 it should check roundIdToNextAccessCriteriaId won't be higher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though it's a bit unclear why require it to be up to 4?
Was that meant to be limiting the type or the ID in fact?
// Clear all existing data to prevent stale data | ||
round.accessCriterias[criteriaId].nftContract = address(0); | ||
round.accessCriterias[criteriaId].merkleRoot = bytes32(0); | ||
// @note: When changing allowlists, call removeAllowlistedAddresses first to clear previous entries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be called here then to make sure it's removed?
_validateEditRoundParameters(round); | ||
|
||
for (uint i = 0; i < addressesToRemove_.length; i++) { | ||
unchecked { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this unchecked for? (there's no math operation inside here)
Module__LM_PC_FundingPot__UnspentCapsRoundIdsNotStrictlyIncreasing( | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could move lastSeenRoundId = currentProcessingRoundId; here and delete it from the 3 other places it's done below to avoid code repetition.
{ | ||
Round storage round = rounds[roundId_]; | ||
|
||
if (round.roundEnd == 0 && round.roundCap == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, you could just check if the round ID is lower than the current one in the counter (here and in other places this check is done)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or check roundStart != 0 as it cannot be 0 when a round is added
uint contributorCount = contributors.length; | ||
|
||
// Check batch size is not zero | ||
if (batchSize_ == 0 || batchSize_ > contributorCount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make operations more convenient to set batchSize_ to contributorCount instead of reverting if it's bigger
} | ||
|
||
// --- Personal Cap Check --- | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have an if here to check if personal cap exists/ should be applied
No description provided.